﻿using System.Collections.Generic;
using System.Linq;

namespace Sample.JwtBearer.Api.Services;

public class TokenResult
{
    public bool Success => Errors == null || !Errors.Any();
    public IEnumerable<string> Errors { get; set; } = Array.Empty<string>();

    /// <summary>
    /// 访问 Token
    /// </summary>
    public string AccessToken { get; set; } = string.Empty;

    /// <summary>
    /// Token 类型（Bearer）
    /// </summary>
    public string TokenType { get; set; } = "Bearer";

    /// <summary>
    /// 访问 Token 效期
    /// 单位：s/秒
    /// </summary>
    public int ExpiresIn { get; set; }

    /// <summary>
    /// 刷新 Token
    /// </summary>
    public string RefreshToken { get; set; } = string.Empty;

    /// <summary>
    /// 刷新 Token 效期
    /// 单位：day/天
    /// </summary>
    public int ExpiryTimeOfDay { get; set; }
}